package com.umeng.analytics.pro;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class h implements Serializable {
    private static final long a = 1;
    private Map b;
    private long c;

    public h() {

        this.b = new HashMap();
        this.c = 0;
    }

    static Map a(h arg1) {
        return arg1.b;
    }

    private void a(f arg2, l arg3, List arg4) {
        if (this.a(arg4)) {
            this.a(arg2, arg3);
        } else {
            this.a(arg2, arg4, arg3);
        }
    }

    public boolean a(List arg2) {
        boolean v0 = this.b == null || !this.b.containsKey(arg2) ? false : true;
        return v0;
    }

    public void a(final f fVar, l arg4) {
        try {
            if (this.a(arg4.a())) {
                Object v0_1 = this.b.get(arg4.a());
                if (v0_1 != null) {
                    ((i) v0_1).a(new f() {
                        public void a(Object arg3, boolean arg4) {
                            h.a(h.this).remove(((i) arg3).a());
                            h.a(h.this).put(((i) arg3).b(), arg3);
                            fVar.a(this, false);
                        }
                    }, arg4);
                    return;
                }

                this.a(fVar, arg4.a(), arg4);
                return;
            }

            this.a(fVar, arg4.a(), arg4);
        } catch (Exception v0) {
            by.e("aggregated faild!");
        }
    }

    public void a(f arg3, List arg4, l arg5) {
        i v0 = new i();
        v0.a(arg5);
        this.b.put(arg4, v0);
        arg3.a(this, false);
    }

    private void a(i arg5, i arg6) {
        arg6.c(arg6.g() + arg5.g());
        arg6.b(arg6.f() + arg5.f());
        arg6.a(arg6.e() + arg5.e());
        int v1;
        for (v1 = 0; v1 < arg5.d().size(); ++v1) {
            arg6.a(arg5.d().get(v1));
        }
    }

    public Map a() {
        return this.b;
    }

    public void a(long arg2) {
        this.c = arg2;
    }

    public void a(f arg4) {
        Iterator v1 = this.b.keySet().iterator();
        while (v1.hasNext()) {
            Object v0 = v1.next();
            if (arg4.a()) {
                return;
            }

            arg4.a(this.b.get(v0), false);
        }
    }

    public void a(f arg3, l arg4, List arg5, List arg6) {
        try {
            while (arg5.size() > 0) {
                if (arg5.size() == 1) {
                    if (!this.a(arg6, arg5)) {
                        arg3.a(Boolean.valueOf(false), false);
                        return;
                    }

                    this.a(arg3, arg4, arg5);
                    return;
                }

                if (this.a(arg6, arg5)) {
                    this.a(arg3, arg4, arg5);
                    return;
                }

                arg5.remove(arg5.size() - 1);
            }
        } catch (Exception v0) {
            by.e("overFlowAggregated faild");
        }
    }

    public boolean a(List<String> arg5, List<String> arg6) {
        boolean v2 = false;
        if (arg5 != null && arg5.size() != 0) {
            ArrayList v3 = new ArrayList();
            int v1;
            for (v1 = 0; v1 < arg5.size() - 1; ++v1) {
                ((List) v3).add(d.b(arg5.get(v1)));
            }

            if (arg5 != null && arg5.size() != 0) {
                v2 = ((List) v3).contains(arg6);
            }
        }

        return v2;
    }

    public void a(Map arg2) {
        if (this.b.size() <= 0) {
            this.b = arg2;
        } else {
            this.b(arg2);
        }
    }

    private void b(Map arg8) {
        new ArrayList();
        new ArrayList();
        Iterator v4 = this.b.entrySet().iterator();
        while (v4.hasNext()) {
            Object v3 = v4.next();
            Object v0 = ((Map.Entry) v3).getKey();
            Iterator v5 = this.b.entrySet().iterator();
            while (true) {
                if (!v4.hasNext()) {
                    break;
                }

                Object v1 = v5.next();
                Object v2 = ((Map.Entry) v3).getKey();
                if (!((List) v0).equals(v2)) {
                    this.b.put(v2, ((Map.Entry) v1).getValue());
                    continue;
                }

                v2 = ((Map.Entry) v3).getValue();
                v1 = ((Map.Entry) v1).getValue();
                this.a(((i) v2), ((i) v1));
                this.b.remove(v0);
                this.b.put(v0, v1);
            }
        }
    }

    public long b() {
        return this.c;
    }

    public int c() {
        int v0 = this.b != null ? this.b.size() : 0;
        return v0;
    }

    public void d() {
        this.b.clear();
    }
}

